﻿using System;
using ApplicationLibrary.SqlConnector;

namespace Plumber.Accounting.ModuleData
{
    #region PL_JournalEntry

    public class PL_JournalEntry : Table
    {
        public static string Name = "PL_JournalEntry";

        public static Column<string> JournalNo = new Column<string>(Name, Properties.Resources.T_JournalNo, "JournalNo", LEN.CODE, false, false);
        public static Column<string> Description = new Column<string>(Name, Properties.Resources.T_Description, "Description", LEN.BIG_DESCRIPTION);
        public static Column<DateTime> PostingDate = new Column<DateTime>(Name, Properties.Resources.T_PostingDate, "PostingDate");
        public static Column<bool> Editable = new Column<bool>(Name, "", "Editable");
        public static Column<string> Type = new Column<string>(Name, "", "Type", LEN.CODE);
        public static Column<string> Code = new Column<string>(Name, "", "Code", LEN.CODE);
        public static Column<string> DocumentNo = new Column<string>(Name, "", "DocumentNo", LEN.CODE);
        public static Column<DateTime> DocumentDate = new Column<DateTime>(Name, "", "DocumentDate");
        public static Column<TaxRegisterType> TaxRegister = new Column<TaxRegisterType>(Name, "", "TaxRegister", false);
        public static Column<InvoiceType> InvoiceType = new Column<InvoiceType>(Name, "", "InvoiceType", false);
        public static Column<string> InvoiceNo = new Column<string>(Name, "", "InvoiceNo", LEN.CODE);

        public override iColumn ForeignKey
        {
            get { return JournalNo; }
        }

        public PL_JournalEntry()
        {
            VisibleInRadar(new iColumn[] { JournalNo, Description });
            Tablename = Name;
            DefineKey(new iColumn[] { JournalNo });
        }
    }

    #endregion

    #region PL_JournalEntryDetail

    public class PL_JournalEntryDetail : Table
    {
        public static string Name = "PL_JournalEntryDetail";

        public static Column<string> JournalNo = new Column<string>(Name, "", "JournalNo", LEN.CODE, false, false);
        public static Column<int> Line = new Column<int>(Name, "", "Line", false, false);
        public static Column<string> Type = new Column<string>(Name, "", "Type", LEN.CODE);
        public static Column<string> Code = new Column<string>(Name, "", "Code", LEN.CODE);
        public static Column<string> DocumentNo = new Column<string>(Name, "", "DocumentNo", LEN.CODE);
        public static Column<string> Description = new Column<string>(Name, Properties.Resources.T_Description, "Description", LEN.BIG_DESCRIPTION);
        public static Column<double> From = new Column<double>(Name, "", "FromAmount");
        public static Column<double> To = new Column<double>(Name, "", "ToAmount");
        public static Column<bool> Close = new Column<bool>(Name, "", "Closed");
        public static Column<bool> FromInvoice = new Column<bool>(Name, "", "FromInvoice");
        public static Column<string> InvoiceNo = new Column<string>(Name, "", "InvoiceNo", LEN.CODE);


        public override iColumn ForeignKey
        {
            get { return JournalNo; }
        }

        public PL_JournalEntryDetail()
        {
            Tablename = Name;
            DefineKey(new iColumn[] { JournalNo, Line });
        }
    }

    #endregion

    #region PL_JournalEntryTaxDetail

    public class PL_JournalEntryTaxDetail : Table
    {
        public static string Name = "PL_JournalEntryTaxDetail";

        public static Column<string> JournalNo = new Column<string>(Name, "", "JournalNo", LEN.CODE, false, false);
        public static Column<int> Line = new Column<int>(Name, "", "Line", false, false);
        public static Column<string> TaxCode = new Column<string>(Name, "", "TaxCode", LEN.CODE);
        public static Column<double> TaxPerc = new Column<double>(Name, "", "TaxPerc");
        public static Column<string> Description = new Column<string>(Name, Properties.Resources.T_Description, "Description", LEN.DESCRIPTION);
        public static Column<double> Amount = new Column<double>(Name, "", "Amount");
        public static Column<double> Tax = new Column<double>(Name, "", "Tax");
        public static Column<bool> Deduction = new Column<bool>(Name, "", "Deduction");
        public static Column<double> Total = new Column<double>(Name, "", "Total");
        public static Column<bool> Restraint = new Column<bool>(Name, Properties.Resources.T_SalePayed, "Restraint");
        public static Column<string> RestraintCode = new Column<string>(Name, "", "RestraintCode", LEN.SHORT_CODE);
        public static Column<double> RestraintPerc = new Column<double>(Name, "", "RestraintPerc");
        public static Column<double> RestraintAmount = new Column<double>(Name, "", "RestraintAmount");
        public static Column<bool> BankRestraint = new Column<bool>(Name, "", "BankRestraint");

        public override iColumn ForeignKey
        {
            get { return JournalNo; }
        }

        public PL_JournalEntryTaxDetail()
        {
            Tablename = Name;
            DefineKey(new iColumn[] { JournalNo, Line });
        }
    }

    #endregion

    #region PL_JETemplate

    public class PL_JETemplate : Table
    {
        public static string Name = "PL_JETemplate";

        public static Column<string> Template = new Column<string>(Name, Properties.Resources.T_Template, "Template", LEN.SHORT_CODE, false, false);
        public static Column<string> Description = new Column<string>(Name, Properties.Resources.T_Description, "Description", LEN.BIG_DESCRIPTION);
        public static Column<DateTime> PostingDate = new Column<DateTime>(Name, Properties.Resources.T_PostingDate, "PostingDate");
        public static Column<string> Type = new Column<string>(Name, "", "Type", LEN.CODE);
        public static Column<string> Code = new Column<string>(Name, "", "Code", LEN.CODE);
        public static Column<TaxRegisterType> TaxRegister = new Column<TaxRegisterType>(Name, "", "TaxRegister", false);
        public static Column<InvoiceType> InvoiceType = new Column<InvoiceType>(Name, "", "InvoiceType", false);

        public override iColumn ForeignKey
        {
            get { return Template; }
        }

        public PL_JETemplate()
        {
            VisibleInRadar(new iColumn[] { Template, Description });
            Tablename = Name;
            DefineKey(new iColumn[] { Template });
        }
    }

    #endregion

    #region PL_JETemplateDetail

    public class PL_JETemplateDetail : Table
    {
        public static string Name = "PL_JETemplateDetail";

        public static Column<string> Template = new Column<string>(Name, "", "Template", LEN.CODE, false, false);
        public static Column<int> Line = new Column<int>(Name, "", "Line", false, false);
        public static Column<string> Type = new Column<string>(Name, "", "Type", LEN.CODE);
        public static Column<string> Code = new Column<string>(Name, "", "Code", LEN.CODE);
        public static Column<string> DocumentNo = new Column<string>(Name, "", "DocumentNo", LEN.CODE);
        public static Column<string> Description = new Column<string>(Name, Properties.Resources.T_Description, "Description", LEN.BIG_DESCRIPTION);
        public static Column<double> From = new Column<double>(Name, "", "FromAmount");
        public static Column<double> To = new Column<double>(Name, "", "ToAmount");

        public override iColumn ForeignKey
        {
            get { return Template; }
        }

        public PL_JETemplateDetail()
        {
            Tablename = Name;
            DefineKey(new iColumn[] { Template, Line });
        }
    }

    #endregion

    #region PL_JournalEntryDetailTaxDetail
    public class PL_JETemplateTaxDetail : Table
    {
        public static string Name = "PL_JETemplateTaxDetail";

        public static Column<string> Template = new Column<string>(Name, "", "Template", LEN.CODE, false, false);
        public static Column<int> Line = new Column<int>(Name, "", "Line", false, false);
        public static Column<string> TaxCode = new Column<string>(Name, "", "TaxCode", LEN.CODE);
        public static Column<double> Amount = new Column<double>(Name, "", "Amount");
        public static Column<double> Tax = new Column<double>(Name, "", "Tax");
        public static Column<bool> Deduction = new Column<bool>(Name, "", "Deduction");
        public static Column<double> Total = new Column<double>(Name, "", "Total");

        public override iColumn ForeignKey
        {
            get { return Template; }
        }

        public PL_JETemplateTaxDetail()
        {
            Tablename = Name;
            DefineKey(new iColumn[] { Template, Line });
        }
    }

    #endregion

    #region PL_LiquidationTax
    public class PL_LiquidationTax : Table
    {
        public static string Name = "PL_LiquidationTax";

        public static Column<int> Year = new Column<int>(Name, Properties.Resources.T_Year, "Year", false, false);
        public static Column<PeriodType> Month = new Column<PeriodType>(Name, Properties.Resources.T_Month, "Month", false, false);
        public static Column<double> PrevoiusCredit = new Column<double>   (Name, "", "PrevoiusCredit");
        public static Column<double> SaleDebit      = new Column<double>   (Name, "", "SaleDebit");
        public static Column<double> SaleCredit     = new Column<double>   (Name, "", "SaleCredit");
        public static Column<double> PurchaseDebit  = new Column<double>   (Name, "", "PurchaseDebit");
        public static Column<double> PurchaseCredit = new Column<double>   (Name, "", "PurchaseCredit");
        public static Column<double> CurrentCredit  = new Column<double>   (Name, "", "CurrentCredit");
        public static Column<string> JournalEntryNo = new Column<string>   (Name, "", "JournalEntryNo", LEN.CODE);
        public static Column<DateTime> PaymentDate  = new Column<DateTime> (Name, "", "PaymentDate");
        public static Column<double> PaymentAmount  = new Column<double>   (Name, "", "PaymentAmount");
        public static Column<TaxRegisterType> SaleRegister = new Column<TaxRegisterType>(Name, "", "SaleRegister");
        public static Column<TaxRegisterType> PurchaseRegister = new Column<TaxRegisterType>(Name, "", "PurchaseRegister");

        public override iColumn ForeignKey
        {
            get { return Year; }
        }

        public PL_LiquidationTax()
        {
            VisibleInRadar(new iColumn[] { Year, Month });
            Tablename = Name;
            DefineKey(new iColumn[] { Year, Month });
        }
    }
    #endregion

    #region PL_LiquidationType
    public class PL_LiquidationType : Table
    {
        public static string Name = "PL_LiquidationType";

        public static Column<int> Company = new Column<int>(Name, Properties.Resources.T_Company, "Company", false, false);
        public static Column<int> Year = new Column<int>(Name, Properties.Resources.T_Year, "Year", false, false);
        public static Column<LiquidationType> Type = new Column<LiquidationType>(Name, Properties.Resources.T_Month, "Type", false);

        public override iColumn ForeignKey
        {
            get { return Year; }
        }

        public PL_LiquidationType()
        {
            VisibleInRadar(new iColumn[] { Year, Type });
            Tablename = Name;
            DefineKey(new iColumn[] { Company, Year });
        }
    }
    #endregion
}